<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <title>课程评价</title>
</head>
<body>
<!-- 主题切换按钮 -->
<button onclick="toggleTheme()" class="theme-toggle" style="
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 10px 15px;
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
">
    🌙/☀️
</button>
<h2>${course.courseName} 评价</h2>
<form action="evaluation" method="post">
    <input type="hidden" name="courseId" value="${course.courseId}">

    <!-- 动态维度示例 -->
    <div>
        <label>教学态度：</label>
        <select name="teaching_attitude_score">
            <option value="5">优秀</option>
            <option value="4">良好</option>
            <option value="3">一般</option>
        </select>
        <textarea name="teaching_attitude_comment" placeholder="评语"></textarea>
    </div>
    <div>
        <label>教学方法：</label>
        <select name="teaching_method_score">
            <option value="5">优秀</option>
            <option value="4">良好</option>
            <option value="3">一般</option>
        </select>
        <textarea name="teaching_method_comment" placeholder="评语"></textarea>
    </div>
    <div>
        <label>教学效果：</label>
        <select name="teaching_effect_score">
            <option value="5">优秀</option>
            <option value="4">良好</option>
            <option value="3">一般</option>
        </select>
        <textarea name="teaching_effect_comment" placeholder="评语"></textarea>
    </div>

    <input type="submit" value="提交评价">
</form>
</body>
</html>
<script>
    document.forms[0].addEventListener('submit', function(e) {
        const scores = document.querySelectorAll('select[name$="_score"]');
        if([...scores].every(s => s.value > 0)) return;
        alert('请完成所有维度评分！');
        e.preventDefault();
    });
        // 初始化主题
        function initTheme() {
        const savedTheme = localStorage.getItem('theme') || 'dark';
        const isLight = savedTheme === 'light';
        document.body.classList.toggle('light-mode', isLight);
        document.querySelector('.theme-toggle').textContent = isLight ? '☀️' : '🌙';
    }

        // 切换主题
        function toggleTheme() {
        const body = document.body;
        const isLight = !body.classList.contains('light-mode');
        body.classList.toggle('light-mode');
        localStorage.setItem('theme', isLight ? 'light' : 'dark');
        document.querySelector('.theme-toggle').textContent = isLight ? '☀️' : '🌙';
    }

        // 页面加载时初始化
        window.addEventListener('load', initTheme);
</script>
<link href="css/rDBEval_form.css" rel="stylesheet" type="text/css"/>